package pk.nak.responses;

import java.io.StringReader;

import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;

import org.w3c.dom.Document;
import org.w3c.dom.NodeList;
import org.xml.sax.InputSource;

public class CreateUserResponse extends BaseResponse {
	private String message;
	
	@Override
	public void onSuccess(String response) {
		try{
			this.response = response;
			DocumentBuilderFactory dbfResponse = DocumentBuilderFactory.newInstance();
	        DocumentBuilder dbResponse = dbfResponse.newDocumentBuilder();
	        
	        Document dom = dbResponse.parse(new InputSource(new StringReader(response)));
	        NodeList nl = dom.getElementsByTagName("api");
	        
	        if ( nl != null && nl.getLength() > 0 ){
	            this.message = nl.item(0).getFirstChild().getNodeValue();
	        }
		}catch(Exception ex){
			
		}
	}

	public String getMessage() {
		return message;
	}

	public void setMessage(String message) {
		this.message = message;
	}
	
}
